package com.jason.controller;

import com.jason.pojo.User;
import com.jason.utils.JWT;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/index")
public class IndexController {
    @RequestMapping("/getCategory")
    public Map<Object, String> getCategory(@RequestParam String token) {
        User user = JWT.unsign(token, User.class);
        Map<Object, String> map = new HashMap<>();
        if (user != null) {
            map.put("1", "手机");
            map.put("2", "电脑");
            map.put("3", "衣物");
            map.put("4", "鞋靴");
            map.put("5", "化妆品");
        } else {
            map.put("error","token过期");
        }
        return map;
    }

}
